initialize few structure fully to zero with talloc_zero
authorvhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Thu, 23 Feb 2006 17:14:55 +0000 (17:14 +0000)
committervhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Thu, 23 Feb 2006 17:14:55 +0000 (17:14 +0000)
instead of explicitely initializing some fields to NULL.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
tools/xenstore/xenstored_core.c

index 2dbcaced5d037adddce7f0c1543a1cedafd3b022..f9629626d9ef5f794a82d651ccb68ffe1bb7cdf5 100644 (file)
@@ -573,14 +573,11 @@ static struct buffered_data *new_buffer(void *ctx)
 {
        struct buffered_data *data;
 
-       data = talloc(ctx, struct buffered_data);
+       data = talloc_zero(ctx, struct buffered_data);
        if (data == NULL)
                return NULL;
        
        data->inhdr = true;
-       data->used = 0;
-       data->buffer = NULL;
-
        return data;
 }
 
@@ -1394,17 +1391,13 @@ static void manual_node(const char *name, const char *child)
        struct node *node;
        struct xs_permissions perms = { .id = 0, .perms = XS_PERM_NONE };
 
-       node = talloc(NULL, struct node);
+       node = talloc_zero(NULL, struct node);
        node->name = name;
        node->perms = &perms;
        node->num_perms = 1;
-       node->data = NULL;
-       node->datalen = 0;
        node->children = (char *)child;
        if (child)
                node->childlen = strlen(child) + 1;
-       else
-               node->childlen = 0;
 
        if (!write_node(NULL, node))
                barf_perror("Could not create initial node %s", name);